home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gdk_imlib_private.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-20  |  7.0 KB  |  236 lines

  1. #ifndef _GDK_IMLIB_PRIVATE_H
  2. #define _GDK_IMLIB_PRIVATE_H
  3.  
  4. #ifndef CONVERT_PATH
  5. #define CONVERT_PATH "/usr/local/bin"
  6. #endif
  7.  
  8. #ifndef NETPBM_PATH
  9. #define NETPBM_PATH  "/usr/local/bin"
  10. #endif
  11.  
  12. #ifndef CJPEG_PROG
  13. #define CJPEG_PROG "/usr/bin/cjpeg"
  14. #endif
  15.  
  16. #ifndef DJPEG_PROG
  17. #define DJPEG_PROG "/usr/local/bin/djpeg"
  18. #endif
  19.  
  20. #include <stdio.h>
  21. #include <unistd.h>
  22. #include <stdlib.h>
  23. #include <math.h>
  24. #include <ctype.h>
  25. #include <time.h>
  26. #include <sys/types.h>
  27. #include <netinet/in.h>
  28. #ifdef HAVE_IPC_H
  29. #include <sys/ipc.h>
  30. #endif
  31. #ifdef HAVE_SHM_H
  32. #include <sys/shm.h>
  33. #endif
  34. #include <sys/time.h>
  35.  
  36. #ifdef _HAVE_STRING_H
  37. #include <string.h>
  38. #elif _HAVE_STRINGS_H
  39. #include <strings.h>
  40. #endif
  41.  
  42. #include <X11/Xlib.h>
  43. #include <X11/Xutil.h>
  44. #include <X11/Xatom.h>
  45. #include <X11/Xos.h>
  46. #ifdef HAVE_XSHM_H
  47. #include <X11/extensions/XShm.h>
  48. #endif
  49. #include <X11/extensions/shape.h>
  50. #include <X11/cursorfont.h>
  51. #include <gdk/gdkprivate.h>
  52. #include <gdk/gdkx.h>
  53.  
  54. #define BYTE_ORD_24_RGB 0
  55. #define BYTE_ORD_24_RBG 1
  56. #define BYTE_ORD_24_BRG 2
  57. #define BYTE_ORD_24_BGR 3
  58. #define BYTE_ORD_24_GRB 4
  59. #define BYTE_ORD_24_GBR 5
  60.  
  61. struct image_cache
  62.   {
  63.     gchar              *file;
  64.     GdkImlibImage      *im;
  65.     gint                refnum;
  66.     gchar               dirty;
  67.     struct image_cache *prev;
  68.     struct image_cache *next;
  69.   };
  70.  
  71. struct pixmap_cache
  72.   {
  73.     GdkImlibImage      *im;
  74.     gchar              *file;
  75.     gchar               dirty;
  76.     gint                width, height;
  77.     GdkPixmap          *pmap;
  78.     GdkBitmap          *shape_mask;
  79.     XImage             *xim, *sxim;
  80.     gint                refnum;
  81.     struct pixmap_cache *prev;
  82.     struct pixmap_cache *next;
  83.   };
  84.  
  85. typedef struct _xdata
  86.   {
  87.     Display            *disp;
  88.     gint                screen;
  89.     Window              root;
  90.     Visual             *visual;
  91.     gint                depth;
  92.     gint                render_depth;
  93.     Colormap            root_cmap;
  94.     gchar               shm;
  95.     gchar               shmp;
  96.     gint                shm_event;
  97.     XImage             *last_xim;
  98.     XImage             *last_sxim;
  99.     Window              base_window;
  100.     GdkWindow          *gdk_win;
  101.     GdkColormap        *gdk_cmap;
  102.     gint                byte_order, bit_order;
  103. #ifdef HAVE_SHM
  104.     XShmSegmentInfo     last_shminfo;
  105.     XShmSegmentInfo     last_sshminfo;
  106. #endif
  107.   }
  108. Xdata;
  109.  
  110. typedef struct _imlibdata
  111.   {
  112.     gint                num_colors;
  113.     GdkImlibColor      *palette;
  114.     GdkImlibColor      *palette_orig;
  115.     unsigned char      *fast_rgb;
  116.     gint               *fast_err;
  117.     gint               *fast_erg;
  118.     gint               *fast_erb;
  119.     gint                render_type;
  120.     gint                max_shm;
  121.     gint                byte_order;
  122.     struct _cache
  123.       {
  124.     gchar               on_image;
  125.     gint                size_image;
  126.     gint                num_image;
  127.     gint                used_image;
  128.         struct image_cache *image;
  129.         gchar               on_pixmap;
  130.         gint                size_pixmap;
  131.         gint                num_pixmap;
  132.         gint                used_pixmap;
  133.         struct pixmap_cache *pixmap;
  134.       }
  135.     cache;
  136.     gchar               fastrend;
  137.     gchar               hiq;
  138.     GdkImlibColorModifier mod, rmod, gmod, bmod;
  139.     unsigned char       rmap[256], gmap[256], bmap[256];
  140.     gchar               fallback;
  141.     gchar               ordered_dither;
  142.     Xdata               x;
  143.   }
  144. ImlibData;
  145.  
  146. extern ImlibData   *_gdk_imlib_data;
  147.  
  148. gint                _gdk_imlib_index_best_color_match(gint * r, gint * g, gint * b);
  149. void                gdk_imlib_load_default_colors__private (void);
  150.  
  151. void                _gdk_imlib_dirty_pixmaps(GdkImlibImage * im);
  152. void                _gdk_imlib_dirty_images(GdkImlibImage * im);
  153. void                _gdk_imlib_find_pixmap(GdkImlibImage * im, int width, int height, GdkPixmap ** pmap, GdkBitmap ** mask);
  154. GdkImlibImage      *_gdk_imlib_find_image(char *file);
  155. void                _gdk_imlib_free_pixmappmap(GdkPixmap * pmap);
  156. void                _gdk_imlib_free_image(GdkImlibImage * im);
  157. void                _gdk_imlib_flush_image(GdkImlibImage * im);
  158. void                _gdk_imlib_add_image(GdkImlibImage * im, char *file);
  159. void                _gdk_imlib_add_pixmap(GdkImlibImage * im, int width, int height, XImage * xim, XImage * sxim);
  160. void                _gdk_imlib_clean_caches(void);
  161. void                _gdk_imlib_nullify_image(GdkImlibImage * im);
  162.  
  163. /* char *g_SplitID(char *file); */
  164. char               *_gdk_imlib_GetExtension(char *file);
  165.  
  166. int                 _gdk_imlib_ispnm(FILE *f);
  167. int                 _gdk_imlib_isjpeg(FILE *f);
  168. int                 _gdk_imlib_ispng(FILE *f);
  169. int                 _gdk_imlib_istiff(FILE *f);
  170. int                 _gdk_imlib_iseim(FILE *f);
  171. int                 _gdk_imlib_isgif(FILE *f);
  172. int                 _gdk_imlib_isxpm(FILE *f);
  173. int                 _gdk_imlib_isbmp(FILE *f);
  174.  
  175. void *            _gdk_malloc_image(unsigned int, unsigned int);
  176.  
  177. GdkPixmap          *gdk_imlib_pixmap_foreign_new(gint width, gint height, gint depth, Pixmap pmap);
  178.  
  179. void                _gdk_imlib_calc_map_tables(GdkImlibImage * im);
  180.  
  181. FILE               *_gdk_imlib_open_helper(const char *, const char *, const char *);
  182. int                 _gdk_imlib_close_helper(FILE *);
  183.  
  184. #define INDEX_RGB(r,g,b)  id->fast_rgb[(r<<10)|(g<<5)|(b)]
  185. #define COLOR_INDEX(i)    id->palette[i].pixel
  186. #define COLOR_RGB(r,g,b)  id->palette[INDEX_RGB(r,g,b)].pixel
  187. #define ERROR_RED(rr,i)   rr-id->palette[i].r;
  188. #define ERROR_GRN(gg,i)   gg-id->palette[i].g;
  189. #define ERROR_BLU(bb,i)   bb-id->palette[i].b;
  190.  
  191. #define DITHER_ERROR(Der1,Der2,Dex,Der,Deg,Deb) \
  192. ter=&(Der1[Dex]);\
  193. (*ter)+=(Der*7)>>4;ter++;\
  194. (*ter)+=(Deg*7)>>4;ter++;\
  195. (*ter)+=(Deb*7)>>4;\
  196. ter=&(Der2[Dex-6]);\
  197. (*ter)+=(Der*3)>>4;ter++;\
  198. (*ter)+=(Deg*3)>>4;ter++;\
  199. (*ter)+=(Deb*3)>>4;ter++;\
  200. (*ter)+=(Der*5)>>4;ter++;\
  201. (*ter)+=(Deg*5)>>4;ter++;\
  202. (*ter)+=(Deb*5)>>4;ter++;\
  203. (*ter)+=Der>>4;ter++;\
  204. (*ter)+=Deg>>4;ter++;\
  205. (*ter)+=Deb>>4;
  206.  
  207. typedef unsigned char *(*gdk_imlib_loader_fn) (FILE *, int *w, int *h, int *transp);
  208. typedef unsigned char *(*gdk_imlib_loader_fn2)(FILE *, char *fname, int *w, int *h, int *trans);
  209.  
  210. extern gdk_imlib_loader_fn _gdk_imlib_LoadBMP;
  211. extern gdk_imlib_loader_fn _gdk_imlib_LoadXPM;
  212. extern gdk_imlib_loader_fn _gdk_imlib_LoadGIF;
  213. extern gdk_imlib_loader_fn2 _gdk_imlib_LoadTIFF;
  214. extern gdk_imlib_loader_fn _gdk_imlib_LoadJPEG;
  215. extern gdk_imlib_loader_fn _gdk_imlib_LoadPNG;
  216. extern gdk_imlib_loader_fn _gdk_imlib_LoadPPM;
  217.  
  218. typedef gint (*gdk_imlib_saver_fn)(GdkImlibImage *im, char *file, GdkImlibSaveInfo *info);
  219.  
  220. extern gdk_imlib_saver_fn _gdk_imlib_SavePNG;
  221. extern gdk_imlib_saver_fn _gdk_imlib_SaveTIFF;
  222. extern gdk_imlib_saver_fn _gdk_imlib_SavePNG;
  223. extern gdk_imlib_saver_fn _gdk_imlib_SaveJPEG;
  224. extern gdk_imlib_saver_fn _gdk_imlib_SavePS;
  225. extern gdk_imlib_saver_fn _gdk_imlib_SavePPM;
  226.  
  227. typedef GdkImlibImage * (*gdk_imlib_inline_fn)(unsigned char *data, int data_size);
  228.  
  229. extern gdk_imlib_inline_fn _gdk_imlib_inlined_png_to_image;
  230.  
  231. typedef GdkImlibImage *(*gdk_imlib_load_alpha_fn)(char *file);
  232.  
  233. extern gdk_imlib_load_alpha_fn _gdk_imlib_load_alpha_png;
  234.  
  235. #endif
  236.